//
//  NSTextViewExtension.swift
//  JKTools
//
//  Created by 姜奎 on 2024/4/19.
//

import Cocoa

extension NSTextView {
    open override func performKeyEquivalent(with event: NSEvent) -> Bool {
        
        switch event.charactersIgnoringModifiers {
            case "a","A":
                return NSApp.sendAction(#selector(NSText.selectAll(_:)), to: self.window?.firstResponder, from: self)
            case "c","C":
                return NSApp.sendAction(#selector(NSText.copy(_:)), to: self.window?.firstResponder, from: self)
            case "v","V":
                return NSApp.sendAction(#selector(NSText.paste(_:)), to: self.window?.firstResponder, from: self)
            case "x","X":
                return NSApp.sendAction(#selector(NSText.cut(_:)), to: self.window?.firstResponder, from: self)
            default:
                return super.performKeyEquivalent(with: event)
        }
    }
}

